package jannex.label;

import java.util.AbstractList;
import java.util.Collection;

public abstract class LabelList extends AbstractList<String> {

    static EmptyLabelList EMPTY = new EmptyLabelList();

    public abstract String[] toArray();

    public LabelList of(String... labels) {
        if (labels.length == 0) {
            return EMPTY;
        } else if (labels.length == 1) {
            return new SingletonLabelList(labels[0]);
        }
        return new ArrayLabelList(labels);
    }

    @Override
    @Deprecated
    public boolean add(String label) {
        throw new UnsupportedOperationException();
    }

    @Override
    @Deprecated
    public boolean remove(Object o) {
        throw new UnsupportedOperationException();
    }

    @Override
    @Deprecated
    public boolean addAll(Collection<? extends String> c) {
        throw new UnsupportedOperationException();
    }

    @Override
    @Deprecated
    public boolean removeAll(Collection<?> c) {
        throw new UnsupportedOperationException();
    }

    @Override
    @Deprecated
    public boolean retainAll(Collection<?> c) {
        throw new UnsupportedOperationException();
    }

    @Override
    @Deprecated
    public void clear() {
        throw new UnsupportedOperationException();
    }
}
